package com.ymatou.iapi.sellerproduct.service;

import org.json.JSONException;
import org.json.JSONObject;

import com.ymttest.business.YmatouAutoTestCall;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.MapUtil;

public class UpdateProductSensitiveWordCall  extends YmatouAutoTestCall {

	private static String opurl ="/api/SellerProduct/UpdateProductSensitiveWord";

	public UpdateProductSensitiveWordCall() {
		super(EnvSetup.getSystemUrl("sellerproduct_iapi"),opurl,"POST","JSON");
	}
	
	public void addDefHeader() {
		client.addHeader("Content-Type", "application/json");
	}
	public static void main(String[] args) {
		UpdateProductSensitiveWordCall aCall = new UpdateProductSensitiveWordCall();
		System.out.println(aCall.call("742b0a98-9fad-455c-a021-e4e4f5268ae6", 3383,  1,"fyf"));
	}
	


	public boolean call(String productId, int sellerId, int propertyType, String sensitiveWord){
		JSONObject retObj = this.callAndGetReturnData(MapUtil.hashMap("ProductId", productId, 
						"SellerId", sellerId, "PropertyTypes", propertyType,"SensitiveWord",sensitiveWord));
		try {
			return retObj.has("response")&&retObj.getString("response").contains("ok")?true:false;
		} catch (JSONException e) {
			e.printStackTrace();
		}
		return false;
	
	}
}